Last digit of a large number

05.04.2023

Write a function that calculates the last digit of a number that is obtained by raising a non-negative integer 'a' to the power of another non-negative integer 'b'. Please note that 'a' and 'b' can be very large.For example, if 'a' is 9 and 'b' is 7, the function should return 9 because 9^7 = 4782969, and the last digit of 4782969 is 9. Another example is if 'a' is (2^200) and 'b' is 300, which results in a number with over 10^92 decimal digits. In this case, the function should return 6 as the last digit of the number. Lastly, it should be noted that the function should take 0 to be 1.

Blog_Description